/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import type.SalesForecastPeriodType;

/**
 *
 * @author wei
 */
@Entity(name="ExpectedYearOnYearGrowth")
public class ExpectedYearOnYearGrowthEntity extends DataObjectEntity implements Serializable {
    private int yearOfSales;
    private double growthRate;
    private SalesForecastPeriodType type;
    private boolean generated;
    
    
    @OneToMany(cascade={CascadeType.PERSIST}, mappedBy="expectedYoYGrowth")
    private Collection<SalesForecastEntity> salesForecast = new ArrayList<SalesForecastEntity>();

    public ExpectedYearOnYearGrowthEntity() {
        super();
        setGenerated(false);
    }
    
   
    
    
    
    public SalesForecastPeriodType getForecastPeriodType(){
        return type;
    }
    
    public void setForecastPeriodType(SalesForecastPeriodType type){
        this.type = type;
    }

    public double getGrowthRate() {
        return growthRate;
    }

    public void setGrowthRate(double growthRate) {
        this.growthRate = growthRate;
    }

    public int getYearOfSales() {
        return yearOfSales;
    }

    public void setYearOfSales(int yearOfSales) {
        this.yearOfSales = yearOfSales;
    }

    public Collection<SalesForecastEntity> getSalesForecast() {
        return salesForecast;
    }

    public void setSalesForecast(Collection<SalesForecastEntity> salesForecast) {
        this.salesForecast = salesForecast;
    }
    
    @Override
    public String toString() {
        return type + " of " + yearOfSales;
    }

    @Override
    public String childToString() {
        return "ExpectedYearOnYearGrowthEntity{" + "yearOfSales=" + yearOfSales + ", growthRate=" + growthRate + ", SalesForecastPeriodType=" +type +", salesForecast=" + salesForecast + '}';
    }

    public boolean isGenerated() {
        return generated;
    }

    public void setGenerated(boolean generated) {
        this.generated = generated;
    }

    
}
